Skip to content

Safetensor loading in AnimateDiff conversion scripts#7764

Merged
DN6 merged 3 commits into
mainfrom
animatediff-safetnsors-support
Apr 29, 2024
Merged

Safetensor loading in AnimateDiff conversion scripts#7764
DN6 merged 3 commits into
mainfrom
animatediff-safetnsors-support

Conversation

@DN6
Copy link
Copy Markdown
Collaborator

@DN6 DN6 commented Apr 24, 2024

What does this PR do?

Add support for converting safetensors format AnimateDiff checkpoints to diffusers.

Fixes # (issue)
#7751

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@DN6 DN6 requested a review from sayakpaul April 25, 2024 10:35
Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a single comment.

Comment on lines +38 to +41
if args.use_safetensors:
state_dict = load_file(args.ckpt_path)
else:
state_dict = torch.load(args.ckpt_path, map_location="cpu")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rather condition on the extension? Something like if args.ckpt_path.endswith(".safetensors"):?

@DN6 DN6 merged commit eb96ff0 into main Apr 29, 2024
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants